import { RepoLink, Link } from 'libframe-docs/components'

Prepare your `vite-plugin-ssr` app like following:

 1. Load `dist/server/importBuild.js` in your Vercel serverless function.
    Example: <RepoLink path='/examples/vercel/vercel/render.js' />.
    > Behind the scenes, Vercel bundles your serverless function and therefore needs to know its entire dependency tree;
    > `importBuild.js` enables Vercel to discover the entire dependency tree of your serverless function.

 2. Define a `deploy.sh` script.
    Example: <RepoLink path='/examples/vercel/vercel/deploy.sh' />.

 3. Define `package.json#scripts['vercel-build']` along with `package.json#scripts.build`.
    Example: <RepoLink path='/examples/vercel/package.json' />.
    > Vercel discards all files generated by `package.json#scripts.build`. That's why we need to use `package.json#scripts['vercel-build']`.

While/after adding your Git repository to Vercel, set the following in Vercel's web UI:

 1. Set `FRAMEWORK PRESET` to `Other`.

 2. Add a new environment variable named `ENABLE_FILE_SYSTEM_API` and set its value to `1`.

## See also

 - <Link href="/importBuild.js" />
 - [Vercel Docs - Custom Build Step for Node.js](https://vercel.com/docs/runtimes#advanced-usage/advanced-node-js-usage/custom-build-step-for-node-js).
 - Insightful conversation: [github.com/vercel/vercel/discussions/6393](https://github.com/vercel/vercel/discussions/6393#discussioncomment-1008607).
 - `vercel.json`'s config `includeFiles` doesn't work for files that are not committed to your Git repository: [github.com/vercel/vercel/issues/6478](https://github.com/vercel/vercel/issues/6478).
